//
//  MyLiuShuiTableViewController.m
//  
//
//  Created by 李李善 on 2018/8/24.
//

#import "MyLiuShuiTableViewController.h"
#import "MyLiuShuiTableViewCell.h"
@interface MyLiuShuiTableViewController ()
{
    BOOL _selected;
}
@end

@implementation MyLiuShuiTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

-(void)onClickButton:(UIButton *)button
{
    button.selected  = !button.selected;
    _selected =button.selected;
    [self.tableView reloadData];
}

-(void)onLoadViewByWillAppear:(UIView *)view{
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setTitle:@"收入" forState:UIControlStateNormal];
    [button setTitle:@"支出" forState:UIControlStateSelected];
    [button setImage:[UIImage imageNamed:@"zhuye_weizhijiantou_icon"] forState:UIControlStateNormal];
    button.titleLabel.font = kSysFont(kFitW(15));
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(onClickButton:) forControlEvents:UIControlEventTouchUpInside];
    [button sizeToFit];
    [view addV:button];
   
    [self.tableView config:^(UITableView *tableView) {
        tableView.backgroundColor = hexCOLOR(@"ECECEC");
        [tableView setSeparatorMan];
        [view addV:tableView];
    }];
    UIView *lin =({
        UIView *l =[UIView new];
        l.backgroundColor = [UIColor colorWithHexString:@"#dbdbdb"];
        [view addV:l];
        l;
    });
    WSELF(weakSelf);
    [self onMainQueueAddSub:^(UIView *view, CGPoint origin, CGSize size, CGPoint center) {
        
        button.frame = CGRectMake(0, 0, kFitW(100),kFitH(60));
        [button layoutButtonWithEdgeInsetsStyle:(MKButtonEdgeInsetsStyleRight) imageTitleSpace:5];;
        weakSelf.tableView.frame = CGRectMake(0, kFitH(60), size.width,size.height-kFitH(60));
        lin.frame = CGRectMake(0, kFitH(59),size.width,0.5);
    }];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

-(MCCellInfo *)tableView:(UITableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath IsHeight:(BOOL)isheight
{
    return [MCCellInfo configForCellId:cell Class:[MyLiuShuiTableViewCell class] Height:kFitH(60) TableView:tableView IsBian:isheight];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
